home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / gle / util / manip / turboscr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-29  |  2.6 KB  |  158 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <assert.h>
  6. #include <conio.h>
  7. #include <bios.h>
  8. #include <signal.h>
  9. #include <float.h>
  10.  
  11. #define false 0
  12. #define true (!false)
  13.  
  14. #define BCOLOR BLUE
  15. #define FCOLOR MAGENTA
  16. #define HBCOLOR h_bcolor
  17. #define HVCOLOR h_fcolor
  18. #define VCOLOR WHITE
  19.  
  20. extern int h_bcolor;
  21. extern int h_fcolor;
  22.  
  23. int gle_abort(char *s);
  24. int graphmode(void);
  25. int hpgl_initstr(void);
  26.  
  27. scr_refresh()
  28. {
  29. }
  30. int scr_getch()
  31. {
  32. }
  33. void exitcode(int i,int j);
  34. void exitcodef(int i,int j);
  35. scr_init()
  36. {
  37.     signal(SIGFPE,exitcodef);
  38.  
  39.     signal(SIGABRT,exitcode);
  40.     signal(SIGILL,exitcode);
  41.     signal(SIGINT,exitcode);
  42.     signal(SIGSEGV,exitcode);
  43.     signal(SIGTERM,exitcode);
  44. }
  45. int d_tidyup(void);
  46. void exitcode(int i, int j)
  47. {
  48.     static char etxt[60];
  49.     d_tidyup();
  50.     sprintf(etxt,"Exit handler called %d %d \n",i,j);
  51.     gle_abort(etxt);
  52. }
  53. void exitcodef(int i, int j)
  54. {
  55.     d_tidyup();
  56.     printf("Floating point error %d %d \n",i,j);
  57.     if (j==FPE_ZERODIVIDE) gle_abort("Divide by zero \n");
  58.     if (j==FPE_INTDIV0) gle_abort("Interger Divide by zero \n");
  59.     if (j==FPE_OVERFLOW) gle_abort("Numeric overflow \n");
  60.     gle_abort("Floating point Exit handler called");
  61. }
  62. scr_end()
  63. {
  64. }
  65. struct text_info r;
  66. void *screensave;
  67. screen_save()
  68. {
  69.     gettextinfo(&r);
  70.     screensave = malloc(25*80*2);
  71.     if (screensave==NULL) return;
  72.     gettext(1,1,80,25,screensave);
  73. }
  74. screen_restore()
  75. {
  76.     if (screensave==NULL) return;
  77.     puttext(1,1,80,25,screensave);
  78.     free(screensave);
  79.     screensave = NULL;
  80.     textattr(r.attribute);
  81.     window(r.winleft,r.wintop,r.winright,r.winbottom);
  82.     gotoxy(r.curx,r.cury);
  83. }
  84. scr_savexy()
  85. {
  86.     gettextinfo(&r);
  87. }
  88. scr_left(int i)
  89. {
  90.     gotoxy(wherex()-i,wherey());
  91. }
  92. scr_right(int i)
  93. {
  94.     gotoxy(wherex()+i,wherey());
  95. }
  96. scr_restorexy()
  97. {
  98.     textattr(r.attribute);
  99.     window(r.winleft,r.wintop,r.winright,r.winbottom);
  100.     gotoxy(r.curx,r.cury);
  101. }
  102. scr_gets(char *x)
  103. {
  104.     gets(x);
  105. }
  106.  
  107. extern int scr_blackwhite;
  108. scr_norm()  /* yellow on blue */
  109. {
  110.     if (scr_blackwhite) {
  111.         textcolor(WHITE); textbackground(BLACK);
  112.     } else {
  113.         textcolor(YELLOW); textbackground(BLUE);
  114.     }
  115. }
  116. int scr_grey(void);
  117. scr_menuhi()
  118. {
  119.     scr_grey();
  120. }
  121. scr_menuval()
  122. {
  123.     textcolor(WHITE); textbackground(BLUE);
  124. }
  125. scr_menubg()
  126. {
  127.     textcolor(YELLOW); textbackground(BLUE);
  128. }
  129. scr_inv()   /* black on white */
  130. {
  131.     textcolor(WHITE); textbackground(BLACK);
  132. }
  133. scr_grey()  /* black on grey */
  134. {
  135.     textcolor(BLACK); textbackground(LIGHTGRAY);
  136. }
  137. scr_isblackwhite()
  138. {
  139.     char *s;
  140.     s = getenv("CGLE_BLACKWHITE");
  141.     if (s!=NULL) return true;
  142.     else return false;
  143. }
  144. vax_edt(char *s)
  145. {
  146. }
  147. char *getsymbol(char *s)
  148. {
  149.     static char ss[100];
  150.     ss[0] = 0;
  151.     if ( getenv(s) != NULL) strcpy(ss,getenv(s));
  152.     return ss;
  153. }
  154.  
  155.  
  156.  
  157. 
  158.